/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Data;


public class ListTaskGroup {
    private int size;
    //private int index;
    private TaskGroup[] listTaskGr;
    
    public ListTaskGroup(){
        listTaskGr = new TaskGroup[10];
        size = 0;
        //index=1;
        
    }
    
    public void add(TaskGroup taskgr){
        listTaskGr[size] = taskgr;
        taskgr.setIndex(size);
        size++;
        
        
    }
    public void removeAt(int index){
        for(int i = index; i < size; i++){
            listTaskGr[i-1] = listTaskGr[i];
            listTaskGr[i-1].setIndex(listTaskGr[i-1].getIndex()-1);
        }
        size--;
    }
    public int getSize(){
        return size;
    }
    public TaskGroup getAt(int i){
        return listTaskGr[i];
    }
    public TaskGroup toTaskGroup(){
        TaskGroup tg = new TaskGroup("","For Alarm");
        for(int i = 0; i < size; i++){
            for(int j = 0; j < this.getAt(i).getSize(); j++){
                tg.add(this.getAt(i).getAt(j));
            }
        }
        return tg;
    }
    
    
}
